import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/global.css'
import './assets/fonts/iconfont.css'
import axios from 'axios'
import ZkTable from 'vue-table-with-tree-grid'
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
axios.defaults.baseURL = 'https://www.liulongbin.top:8888/api/private/v1/'

Vue.use(VueQuillEditor)
Vue.component('tree-grid', ZkTable)
// 拦截器
axios.interceptors.request.use(config => {
  config.headers.Authorization = sessionStorage.getItem('token')
  return config
})
// 将axios挂载在Vue原型上
Vue.prototype.$axios = axios
Vue.config.productionTip = false

// 定义时间过滤器
Vue.filter('dateFormat', date => {
  const newDate = new Date(date * 1000)
  const y = newDate.getFullYear()
  const m = newDate.getMonth() + 1
  const d = newDate.getDate()
  return y + '-' + m + '-' + d
})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
